import TinyReact from '../src';

const root = document.getElementById('root');

// 实现类组件的更新
class Alert extends TinyReact.Component {
  constructor(props) {
    super(props);
    this.state = {
      title: 'haha',
    };
    this.changeTitle = this.changeTitle.bind(this);
  }
  changeTitle() {
    this.setState({ title: 'xixi' });
  }
  render(props) {
    return (
      <div>
        <h1>Alert:{this.state.title}</h1>
        <button onClick={this.changeTitle}>点击</button>
      </div>
    );
  }
}
TinyReact.render(<Alert />, root);
